package com.aispeech.task.api.controller.api;

import com.aispeech.task.api.controller.base.Base;
import com.aispeech.task.api.service.TaskManageService;
import com.aispeech.task.common.data.vo.response.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/task")
public class Admin extends Base {
    @Autowired
    TaskManageService manageService;

    @GetMapping("query")
    public Result queryAll() {
        return manageService.query();
    }

    @GetMapping("/{productId}/{taskId}")
    public Result get(@PathVariable String taskId, @PathVariable String productId) {
        return manageService.get(taskId, productId);
    }

    @PostMapping("/{productId}/{taskId}/interrupt")
    public Result interrupt(@PathVariable String taskId, @PathVariable String productId) {
        return manageService.interrupt(taskId, productId);
    }

    @PostMapping("/{productId}/{taskId}/reset")
    public Result reset(@PathVariable String taskId, @PathVariable String productId) {
        return manageService.reset(taskId, productId);
    }
}
